package com.wg.msproductgz.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wg.msproductgz.entity.Productspec;
import com.wg.msproductgz.mapper.ProductspecMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductspecService extends ServiceImpl<ProductspecMapper, Productspec> {
    @Autowired
    private ProductspecMapper productspecMapper;
    public List<Productspec> select(Productspec productspec){
        QueryWrapper<Productspec> queryWrapper=new QueryWrapper<>();
        if (productspec.getId()!=null){
            queryWrapper.eq("id",productspec.getId());
        } else if (productspec.getProductId()!=null) {
            queryWrapper.eq("product_id",productspec.getProductId());
        } else if (productspec.getSpecName()!=null) {
            queryWrapper.eq("spec_name",productspec.getSpecName());

        }
        return productspecMapper.selectList(queryWrapper);
    }
}
